﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BLL.Validation;
using Enities;
using DAL;
using System.Linq.Expressions;


namespace BLL
{
    public class QLPhieuNhap
    {
        //su dung lop repository tong quat
        private readonly IGeneralRepository<PhieuNhap> _repository;
        public QLPhieuNhap(IGeneralRepository<PhieuNhap> itr)
        {
            _repository = itr;
        }

        public ActionResult InsertOrUpdate(PhieuNhap phieunhap)
        {
            var aResult = new ActionResult();
            try
            {
                if (!_repository.InsertOrUpdate(phieunhap)) 
                aResult.Exceptions.Add(new Exception("Thêm mới phieu nhap không thành công"));
            }
            catch (Exception ex)
			{
				aResult.Exceptions.Add(ex);
			}
			return aResult;
        }

    }
}
